package mt;

import java.util.Scanner;
import java.util.Arrays;

public class q2 {

    private static final long MOD = 1000000007;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 读取输入的四个正整数
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long c = scanner.nextLong();
        long k = scanner.nextLong();

        // 将 a, b, c 排序，确保 a <= b <= c
        long[] arr = {a, b, c};
        Arrays.sort(arr);

        // 分配 k 次操作
        if (k > 0) {
            long diff = arr[1] - arr[0];  // b - a
            if (k >= diff) {
                arr[0] += diff;
                k -= diff;
            } else {
                arr[0] += k;
                k = 0;
            }
        }

        if (k > 0) {
            long diff = arr[2] - arr[0];  // c - (a=b)
            if (k >= diff * 2) {
                arr[0] = arr[1] = arr[2];
                k -= diff * 2;
            } else {
                arr[0] += k / 2;
                arr[1] += k / 2;
                k = 0;
            }
        }

        if (k > 0) {
            arr[0] += k / 3;
            arr[1] += k / 3;
            arr[2] += k / 3;
            k %= 3;
            if (k > 0) arr[2]++;
        }

        // 计算乘积并对结果取模
        long result = ((arr[0] % MOD) * (arr[1] % MOD) % MOD * (arr[2] % MOD)) % MOD;

        // 输出结果
        System.out.println(result);
        scanner.close();
    }
}
